package com.oracle.pojo;

import lombok.Data;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

@Data
public class User extends BasePojo{
    private String userName;
    private String userCode;
    private String userPassword;
    private int gender;
    private Date birthday;
    private String phone;
    private String address;
    private Role role;
    private int age;
    private List<Address> addressList;
    public int getAge() {
        Calendar calendar1 = Calendar.getInstance();
        calendar1.setTime(new Date());
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTime(this.birthday);
        age=calendar1.get(Calendar.YEAR)-calendar2.get(Calendar.YEAR);

        return age;
    }
}
